﻿@{
    ViewBag.Title = "GriderCommission";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    @Html.Partial("~/Views/Modular/ToolBarReport.cshtml")           
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">单据日期：</td>
                <td width ="310px">
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="150px">
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")                 
                </td>
                <td width ="70px" align="right">导购员：</td>
                <td width ="150px">
                    @Html.Partial("~/Views/Modular/LookupGuider.cshtml")                 
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetBillList"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell"
            fitColumns="false" sortMode="client">
            <div property="columns">
                <div field="FNumber" name="FNumber" width="100" headerAlign="center">导购员编号</div>    
                <div field="FName" name="FName" width="120px"  headerAlign="center">导购员名称</div> 
                <div header="销售提成" headerAlign="center">
                    <div property="columns">
                        <div field="FRealAmount" width="80"   headerAlign="center" numberFormat="#,0.00" align="right">实收</div>
                        <div field="FSaleAmount" width="80"   headerAlign="center" numberFormat="#,0.00" align="right">提成金额</div>
                    </div>
                </div>
                <div header="储值卡充值提成" headerAlign="center">
                    <div property="columns">
                        <div field="FRecPay" width="80"  headerAlign="center" numberFormat="#,0.00" align="right">充值金额</div>
                        <div field="FRecAmount" width="80"   headerAlign="center" numberFormat="#,0.00" align="right">提成金额</div>
                    </div>
                </div>
                <div header="次卡销售提成" headerAlign="center">
                    <div property="columns">
                        <div field="FTimeSale" width="80"  headerAlign="center" numberFormat="#,0.00" align="right">销售总额</div>
                        <div field="FTimeAmount" width="80"   headerAlign="center" numberFormat="#,0.00" align="right">提成金额</div>
                    </div>
                </div>
                 <div field="FAmountTotal" width="100"   headerAlign="center" numberFormat="#,0.00" align="right">提成总额</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "FSaleAmount,FRecAmount,FTimeAmount,FAmountTotal";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDate1").setValue(nowDate);
            mini.getbyName("FDate2").setValue(nowDate);
            search();
        }


        function search() {
            var cDate1 = mini.getbyName("FDate1").getFormValue();
            var cDate2 = mini.getbyName("FDate2").getFormValue();
            var mStockID = mini.getbyName("FStockID").getValue();
            var mEmpID = mini.getbyName("FGuiderNumber").getValue();

            var json = "[{";
            json = json + '"mListType":' + '"' + hdatatype + '",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDate1":' + '"' + cDate1 + ' 00:00:00",';
            json = json + '"mDate2":' + '"' + cDate2 + ' 23:59:59",';
            json = json + '"mEmpID":' + '"' + mEmpID + '",';
            json = json + '"mStockID":"' + mStockID + '"}]';

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;
        }

        function onSelectionChanged(e) {
            var mgrid = e.sender;
            var record = mgrid.getSelected();
            if (record) {
                var mCheckFlag = record.FCheckFlag;
                if (!mCheckFlag) {
                    mini.get("removebill").setEnabled(true);
                }
                else {
                    mini.get("removebill").setEnabled(false);
                }
            }
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "导购员绩效表");
                }
            });
        }

    </script>

    </form>
</body>